Skip to content

Add aa-install to manage profiles - #1183

Open
roddhjav wants to merge 44 commits into
mainfrom
install
Open

Add aa-install to manage profiles#1183
roddhjav wants to merge 44 commits into
mainfrom
install

Conversation

@roddhjav

@roddhjav roddhjav commented Jul 27, 2026

Copy link
Copy Markdown
Owner

This PR split the unified apparmor.d package into three packages:

  • apparmor.d-tools: for apparmor.d tools such as aa-log, and the new tool aa-install
  • apparmor.d-base: for abstractions, and tunables. Installed in /etc/apparmor.d/
  • apparmor.d: for all prebuilt profiles, installed in /usr/share/apparmor.d/ (it could have been /usr/lib/apparmor.d, however, future upstream profiles may use this location, and I do not want to conflict with them).

Upon installation of apparmor.d, and after each install of a new program, a trigger/hook (re)install the profiles.

aa-install install and manage the AppArmor profiles shipped by apparmor.d. Profiles are built from /usr/share/apparmor.d/, filtered and flagged according to the configuration, then deployed to the AppArmor policy directory and apparmor is reloaded.

Installed profiles are recorded in a manifest so that later runs can report the installation status, list the deployed profiles, or uninstall them.

Configuration files:

  modes              Modes of enforcement for all profiles.
  flags.d/*.conf     Set per-profile flags.
  ignore.d/*.conf    Set (group of) profiles to ignore.
  include.d/*.conf   Set (group of) profiles to install.
  overwrite.d/*.conf Set upstream profiles to disable and replace.

Configuration directories:

/usr/share/apparmor/ - Vendor defaults are read first
/etc/apparmor/       - Local admin configuration, can overwritte /usr/share/apparmor/, and be overwritten by --config DIR.

Mode keys:

 default complain | enforce   - Global profile mode to apply
 include  default | full

See man aa-install(1) for more information.

See #986

roddhjav added 26 commits July 28, 2026 00:34
At install time the list of upstream profiles to disable is not
available, but the disable/ symlinks shipped by the package are. Use
them as source and move the upstream profile aside as <name>.<pkgname>,
like the prebuild Overwrite task does.
SetFlags now takes a list of flags files or *.conf dirs, read in order,
so aa-install can feed it the user config dirs. Flag rewriting moves to
util.ApplyFlags and profiles moved aside by overwrite are resolved as
<profile>.<pkgname>.
Inverse of Ignore: keep only the profiles and groups listed in the
*.conf files of the user config dirs, everything else is removed. When
any include rule is set, this task takes over profile selection from
Install.
Only keep profiles whose attachment resolves to a program present on the
system. Attachments are read from the built profile header, AppArmor
variables are substituted to filesystem globs, and profiles with no
attachment follow their group. Disable symlinks are reconciled with the
profiles actually kept.
The groups/ tree is flattened by the Merge task, so group membership is
saved in the shared task config for the later tasks that need it.
Set a default enforce/complain mode on every profile at install time,
except the profiles a user flags.d drop-in already assigns a mode to.
…graph.

A paragraph starting with `}` continues the conditional block of the
previous one, its matching `{` is there, so the tokenizer would see
unbalanced braces. Merge them instead.
Install, update and remove the apparmor.d profiles from the source tree
to /etc/apparmor.d. Profile selection, flags and deploy mode come from
the vendor and admin config dirs, and an installed-file manifest is kept
so status, list and uninstall know exactly what was written.
debian/apparmor.d.hide is now a static file in the package, so there is no need to write it from prebuild.
@roddhjav roddhjav changed the title Manage profiles with aa-install Add aa-install to manage profiles Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant